<!---
	Name         : dsp.search.cfm
	Author       : Raymond Camden 
	Created      : 06/20/06
	Last Updated : 
	History      : 
--->

<cfset webpath = viewState.getValue("webpath")>
<cfset viewState.setValue("title","Search")>
<cfset searchterms = viewState.getValue("searchterms")>
<cfset searchresults = viewState.getValue("searchresults")>

<cfoutput>
<h3 class="title">Search</h3>

<p>
<form action="#viewState.getValue("myself")#search" method="post">
<input type="text" name="searchterms" value="#searchterms#"> <input type="submit" value="Search">
</form>
</p>
</cfoutput>

<cfif searchterms neq "">
	<cfoutput>
	<p>
	Your search for #searchterms# resulted in 
	<cfif isQuery(searchresults) and searchresults.recordCount gt 0>#searchresults.recordCount# result(s)<cfelse>no results</cfif>.
	</cfoutput>
	
	<cfif isQuery(searchresults) and searchresults.recordCount gt 0>
		<cfoutput>
		<table class="versionHistory" border="1">
		<tr>
			<th>Name</th>
			<th>Author</th>
			<th>Time Created</th>
			<th>Version</th>
		</tr>
		</cfoutput>
		<cfoutput query="searchresults">
		<tr <cfif currentRow mod 2>class="alt"</cfif>>
			<td><a href="#webpath#/index.cfm/#urlEncodedFormat(path)#">#path#</a></td>
			<td><cfif len(author)>#author#<cfelse>Anonymous</cfif></td>
			<td>#dateFormat(datetimecreated, "short")# #timeFormat(datetimecreated, "short")#</td>
			<td>#version#</td>
		</tr>
		</cfoutput>
		<cfoutput>
		</table>	
		</cfoutput>	
	</cfif>
</cfif>